import { Module } from "vuex"
import { RootProps } from "../index";

interface Course1Props {
    id:number
    courseImg: string
    courseName: string
    order: number
    myCoach: string
    time: string
    appointment: number
}

export interface Course1ArrayProps {
    tableData: Course1Props[]
}

const course1State: Module<Course1ArrayProps, RootProps> = {
    actions: {
        setCourseTableList({commit},data){
            console.log("action")
            //console.log(data)
            commit("setCourseTableList",data)
        }
    },
    mutations: {
        setCourseTableList(state,data){
            state.tableData=data
        }
    },
    state: {
        tableData:[
            {   id:1,
                courseName: '魔鬼速度减脂课程',
                courseImg:"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
                myCoach: '大明',
                order: 1,
                time: '50分钟',
                appointment: 100
            },
            {   id:2,
                courseName: '健身课程',
                courseImg:"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
                myCoach: '彭于晏',
                order: 2,
                time: '60分钟',
                appointment: 20
            },
            {   id:3,
                courseName: '健身课程',
                courseImg:"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
                myCoach: '李四',
                order:3,
                time: '40分钟',
                appointment: 100
            },
            {   id:4,
                courseName: '魔鬼速度减脂课程',
                courseImg:"https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
                myCoach: '王五',
                order: 4,
                time: '40分钟',
                appointment: 100
            }
        ]
    },
    getters: {
        allTableData(state){
            return state.tableData
        }
    }
}

export default course1State